// pages/Travel/FillOrder/fillOrder.js

Page({

  /**
   * 页面的初始数据
   */
  data: {

    guigeList: [{
      guige: '100000000',
      price: '150'
    }, {
      guige: '200',
      price: '150'
    }],
    showConfirmDialog: true, //是否显示
    confirmDialogCount: 1, //初始数量
    confirmDialogType: 1, //1:加入购物车 2：立即购买
    dialogInputFocus: false,
  },

  /* 点击减号 */
  onConfirmDialogCut: function() {
    var confirmDialogCount = this.data.confirmDialogCount || 0;
    // 如果大于1时，才可以减  
    if (confirmDialogCount <= 1) { //原数量为0
      return;
    } else {
      var confirmDialogCount = confirmDialogCount - 1
      this.setData({
        confirmDialogCount: confirmDialogCount,
      });
    }
  },
  /* 点击加号 */
  onConfirmDialogAdd: function() {
    var confirmDialogCount = this.data.confirmDialogCount || 0;
    confirmDialogCount++;
    this.setData({
      confirmDialogCount: confirmDialogCount,
    });
  },

  onConfirmDialogInput(e) {
    var count = e.detail.value
    this.setData({
      confirmDialogCount: count
    })
  },

  //显示对话框
  showConfirmDialog: function() {

    this.setData({
      showConfirmDialog: true
    })

  },
  //隐藏对话框
  hideConfirmDialog: function() {
    this.setData({
      showConfirmDialog: false,
      dialogInputFocus: false
    })
  },
  onConfirmDialogInputClick() {
    this.setData({
      dialogInputFocus: true,
    })
  },

  onConfirmDialogBtnClick() {
    if (this.data.confirmDialogType == 1) { //加入购物车

    } else {

    }

  },
  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function(options) {
    var scene = encodeURIComponent('page=pd;a=4;b=1')
    wx.redirectTo({
      // url: '/pages/splash/splash?page=pd&a=4&b=1',
      // url: '/pages/splash/splash?page=fruit-check-detail&appId=2&recordId=2'
      // url: '/pages/splash/splash?page=soil-check-detail&appId=2&recordId=2'
      // url: '/pages/splash/splash?page=field-service-detail&appId=2&recordId=2'

      url: '/pages/splash/splash?scene=' + scene
    })
  },
})